package net.lab1024.sa.admin.module.business.roland.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.lab1024.sa.admin.module.business.roland.domain.form.RolandPerformanceTypeAddForm;
import net.lab1024.sa.admin.module.business.roland.domain.form.RolandPerformanceTypeQueryForm;
import net.lab1024.sa.admin.module.business.roland.domain.form.RolandPerformanceTypeUpdateForm;
import net.lab1024.sa.admin.module.business.roland.domain.vo.PerformanceTypeSelectVO;
import net.lab1024.sa.admin.module.business.roland.domain.vo.RolandPerformanceTypeVO;
import net.lab1024.sa.admin.module.business.roland.service.RolandPerformanceTypeService;
import net.lab1024.sa.common.common.domain.PageResult;
import net.lab1024.sa.common.common.domain.ResponseDTO;
import net.lab1024.sa.common.common.domain.ValidateList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * 演出类型表 Controller
 *
 * @Author dragon
 * @Date 2023-12-11 13:27:12
 * @Copyright dragon
 */

@RestController
@Api(tags = "")
public class RolandPerformanceTypeController {

    @Autowired
    private RolandPerformanceTypeService rolandPerformanceTypeService;

    @ApiOperation("分页查询 @author dragon")
    @PostMapping("/rolandPerformanceType/queryPage")
    public ResponseDTO<PageResult<RolandPerformanceTypeVO>> queryPage(@RequestBody @Valid RolandPerformanceTypeQueryForm queryForm) {
        return ResponseDTO.ok(rolandPerformanceTypeService.queryPage(queryForm));
    }

    @ApiOperation("添加 @author dragon")
    @PostMapping("/rolandPerformanceType/add")
    public ResponseDTO<String> add(@RequestBody @Valid RolandPerformanceTypeAddForm addForm) {
        return rolandPerformanceTypeService.add(addForm);
    }

    @ApiOperation("更新 @author dragon")
    @PostMapping("/rolandPerformanceType/update")
    public ResponseDTO<String> update(@RequestBody @Valid RolandPerformanceTypeUpdateForm updateForm) {
        return rolandPerformanceTypeService.update(updateForm);
    }

    @ApiOperation("批量删除 @author dragon")
    @PostMapping("/rolandPerformanceType/batchDelete")
    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return rolandPerformanceTypeService.batchDelete(idList);
    }

    @ApiOperation("单个删除 @author dragon")
    @GetMapping("/rolandPerformanceType/delete/{id}")
    public ResponseDTO<String> batchDelete(@PathVariable Integer id) {
        return rolandPerformanceTypeService.delete(id);
    }

    @ApiOperation("表演节目下拉 @author dragon")
    @GetMapping("/rolandPerformanceType/queryAll")
    public ResponseDTO<List<PerformanceTypeSelectVO>> queryAll() {
        return rolandPerformanceTypeService.queryAll();
    }
}
